Decimals in programming aren't precise -- Floating Point Imprecision

Week 1 - Data Types, Imprecision and Overflows

Created: 2022-05-13
Tags: #permanent


Working with decimals using float is tricky especially when computers can only understand binary digits. Most fractional decimals especially infinite decimals can't be represented precisely in binary.

Possible Alternative:
Use double

  • Will still give you errors for certain calculations but more accurate than float[1]